package com.lmabbe.tenant.objects.converter;

import com.lmabbe.tenant.objects.dto.TenantDatabasesDTO;
import com.lmabbe.tenant.objects.entity.TenantDatabases;
import com.lmabbe.tenant.objects.vo.TenantDatabasesVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

import java.util.List;

/**
 * 租户数据库表 转换器
 *
 * @author lmabbe
 */
@Mapper(componentModel = "spring")
public interface TenantDatabasesConverter {

    /**
     * dto转实体
     *
     * @param to
     * @return
     */
    TenantDatabases dto2Entity(TenantDatabasesDTO to);

    /**
     * dto转实体
     *
     * @param to
     * @return
     */
    @Mapping(target = "dsId", source = "dsId")
    TenantDatabases dto2Entity(TenantDatabasesDTO to, Long dsId);

    /**
     * 数据列表转Vo列表
     *
     * @param list
     * @return
     */
    List<TenantDatabasesVO> list2Vos(List<TenantDatabases> list);

    /**
     * 实体转VO
     *
     * @param entity
     * @return
     */
    TenantDatabasesVO entity2Vo(TenantDatabases entity);
}